## GPU CPU 直通设置 重启
sudo timedatectl set-ntp true
sudo ln -sf /usr/share/zoneinfo/Asia/Shanghai /etc/localtime
sudo hwclock --systohc
sudo locale-gen
echo 'nameserver 180.184.1.1' >/etc/resolv.conf
echo 'Server = https://mirrors.pku.edu.cn/archlinux/$repo/os/$arch' >/etc/pacman.d/mirrorlist
pip config set global.index-url https://pypi.tuna.tsinghua.edu.cn/simple
pip config set global.cache-dir /data/pipcache

## 更新 认证
sudo rm -R /etc/pacman.d/gnupg
sudo pacman-key --init
sudo pacman-key --populate archlinux #archlinuxcn
# sudo pacman-key --refresh-keys
sudo pacman -Sy archlinux-keyring archlinuxcn-keyring --noconfirm
# sudo pacman-key --populate archlinuxcn
# sudo pacman -Sy archlinuxcn-keyring
sudo pacman -Sc --noconfirm
sudo pacman -Syyu --noconfirm

# 安装驱动 #无效
lspci | grep nouveau
lspci | grep -i nvidia

########=========================
# 不要以root用户安装 可以安装最新版版本驱动
paru -S libnvidia-container-tools libnvidia-container-bin
paru -Syyu --needed linux-headers lsb-release intel-ucode nvidia-beta cuda --noconfirm

# 修改运行时
cd /var/lib/k8e/agent/etc/containerd
cp config.toml config.toml.tmpl
#将nvida 设置为默认
[plugins."io.containerd.grpc.v1.cri".containerd]
snapshotter = "overlayfs"
disable_snapshot_annotations = true
default_runtime_name = "nvidia"

kubectl create -f https://ghproxy.net/https://raw.githubusercontent.com/NVIDIA/k8s-device-plugin/main/deployments/static/nvidia-device-plugin.yml

######----------docker

## 挂载硬盘
mkdir /data
mount /dev/vdb1 /data

df -h
lsblk -o NAME,UUID

echo UUID=3f62f3ac-494c-41a3-be5f-8cf02ec0449b /data ext4 defaults 0 0 >>/etc/fstab

cat /etc/fstab

# 安装 wasmedge
# wasmedge nn
curl -sSf https://gitee.com/softyouling/mydotfiles/raw/main/chat_oneapi_llm/wasmedge_install/install/install_wasmedge.sh | bash -s -- --plugin wasi_nn-ggml
source $HOME/.wasmedge/env

## docker image 更改地址
# /etc/docker/daemon.json
# "data-root": "/data/dockercache"

wget "https://ghproxy.net/github.com/docker/compose/releases/download/v2.23.0/docker-compose-linux-x86_64"
mv docker-compose-linux-x86_64 /usr/local/bin/docker-compose
chmod +x /usr/local/bin/docker-compose

# 配置docker加速
touch /etc/docker/daemon.json
echo '{
    "registry-mirrors": [
        "https://docker.1ms.run",
        "https://docker.lmirror.top",
        "https://docker.1panel.live",
        "https://mirror.baidubce.com",
        "https://docker.nju.edu.cn",
        "https://docker.linkos.org",
        "https://docker.mirrors.ustc.edu.cn",
        "https://registry.dockermiro.com",
        "https://reg-mirror.qiniu.com"
    ],
    "data-root": "/data/docker"
}' | sudo tee -a /etc/docker/daemon.json
